{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	n,i,t:integer;
begin
	t:=0;
	readln(n);
	for i:=1 to n do
		if ((i mod 3)=2) and ((i mod 5)=3) and ((i mod 7)=2) then inc(t);
	writeln(t);
end.
